import React from 'react'
import { inject, observer } from 'mobx-react';
import { withRouter, Route } from 'react-router-dom'
import { Form, RouteLayout } from 'weaver-mobile-page'
import { List, Icon, Bubble, Tools } from 'weaver-mobile';
import {buildUrlStr} from "../../util/forwardPage";
import base from "../../util/base";

const ButtonGroup = RouteLayout.ButtonGroup;
const FormItem = List.FormItem;
const getLabel = Tools.getLabel;

@withRouter
@observer
export default class EasyPicture extends React.Component {
    componentWillMount() {
        // console.log("props",toJS(this.props))
    }
    componentDidMount() {
        const { location } = this.props;
        const { params = {} } = location;
    }
    componentWillUnmount() {
    }

    render() {
        const { location } = this.props;
        const { params = {} } = location;
        const {hasFreeNode = false} = params;
        const {pcUrl='',mobileUrl='',isShowChart='0'} = params;
        const urlParam = {
            requestid:params.requestid,
            workflowid:params.workflowid,
            isbill:params.isbill,
            formid:params.formid,
            nodeid:params.nodeid,
            isfromtab:params.isfromtab,
            f_weaver_belongto_userid:params.f_weaver_belongto_userid,
            f_weaver_belongto_usertype:params.f_weaver_belongto_usertype,
            showE9Pic: "1",
            isFromWfForm:true,
            authSignatureStr:params.authSignatureStr,
            authStr:params.authStr,
            isFree:params.isFree,
            isAllowNodeFreeFlow:'0',
            isReadOnlyModel:'true',
            hasFreeNode:hasFreeNode ? "1" :"0",
            isMobile:'1',
        };

        let wholeMapPicSrc = `/workflow/workflowDesign/m-readOnly.html?v=20200312&isFromWfForm=true&${buildUrlStr(urlParam)}`;
        let src = '';
        if(pcUrl!=''){
            src=pcUrl;
            if(mobileUrl!=''){
                src=mobileUrl;
            }
        }else {
            src = wholeMapPicSrc;
        }
        const {rightMenu = {}} = base.wfOperateStore;
        const {isFree = '0',isAllowNodeFreeFlow = '0'} = rightMenu;
        urlParam['isFree'] = isFree;
        urlParam['isAllowNodeFreeFlow'] = isAllowNodeFreeFlow;
        if(isShowChart=='1'&&pcUrl=='') {
            Bubble.success(getLabel(21430, '流程处理成功'), 2);
        }
        return (
        <div className='picture-container'>
            <div id="wf-map-container" style={{backgroundColor: '#f4f4f4'}}>
                <div >

                </div>
                <div className='map-box map-box-show'>
                    {/*<div className='loading-wrap whole-map' style={{backgroundColor: '#f4f4f4'}}>*/}

                    {/*</div>*/}
                    <iframe id={'whole-map'} src={src}
                            style={{width: "100%", height: "100%", border: "none"}}/>
                </div>

            </div>
        </div>
    )
    }

}